package com.zx.tool;

import java.util.List;

public class Page<T> {
        /**
         * currentPage 当前页
         */
        private int currentPage = 1;
        /**
         * pageSize 每页大小
         */
        private int pageSize = 3;
        /**
         * pageTotal 总页数
         */
        private int pageTotal;
        /**
         * recordTotal 总条数
         */
        private int recordTotal = 0;

        /**
         * content 每页的内容
         */
        private List<T> content;


        public List<T> getContent() {
            return content;
        }

        public void setContent(List<T> content) {
            this.content = content;
        }

        public int getCurrentPage() {
            return currentPage;
        }

        public void setCurrentPage(int currentPage) {
            this.currentPage = currentPage;
        }

        public int getPageSize() {
            return pageSize;
        }

        public void setPageSize(int pageSize) {
            this.pageSize = pageSize;
        }

        public int getPageTotal() {

            ///1   53%5   3     50%5   0
            pageTotal = ((recordTotal%pageSize)==0)?(recordTotal/pageSize):((recordTotal/pageSize)+1) ;
            return pageTotal;
        }

//    public void setPageTotal(int pageTotal) {
//        this.pageTotal = pageTotal;
//    }

        public int getRecordTotal() {
            return recordTotal;
        }

        public void setRecordTotal(int recordTotal) {
            this.recordTotal = recordTotal;
        }



        @Override
        public String toString() {
            return "Page{" +
                    "currentPage=" + currentPage +
                    ", pageSize=" + pageSize +
                    ", pageTotal=" + pageTotal +
                    ", recordTotal=" + recordTotal +
                    ", content=" + content +
                    '}';
        }
}
